let str14: string[]=["flower","flow","flight"]; 
console.log(longestCommonPrefix(str14));''

function longestCommonPrefix(strs: string[]): string {
    let result:string="";
    let flag:boolean
    for(let i=0;i<strs[0].length;i++){
        let newchar=strs[0][i];
        flag=true;
        for(let j=1;j<strs.length;j++){
            if(strs[j][i]===newchar)
                continue
            flag=false;
            break;
        }
        if(flag)
            result+=newchar
        else break;
    }
    return result;
};